package com.base.cn.platform.os.controller.web.op.advert;

import com.base.cn.platform.os.common.WebBaseController;
import com.base.cn.platform.os.common.utils.StringUtils;
import com.base.cn.platform.os.common.utils.result.ResultUtil;
import com.base.cn.platform.os.service.manage.op.advert.OpAdvertService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 前台广告功能
 *
 * @author s.li
 * @create 2018-06-04-16:47
 */
@Controller
@RequestMapping("/web/opAdvert")
public class WebAdvertController extends WebBaseController {

    @Autowired
    private OpAdvertService opAdvertService;

    /**
     * 获取广告数据
     * @param placeKey
     * @return
     */
    @RequestMapping("/queryAdvertList")
    @ResponseBody
    public Map<String,Object> queryAdvertList(@RequestParam("placeKey") String placeKey){
        if(StringUtils.isNotEmpty(placeKey)){
            Map<String,Object> params = new HashMap<>();
            params.put("placeKey",placeKey);
            params.put("status", 1);
            List<Map<String, Object>> advertList = opAdvertService.queryAdvertList(params,false,false,false);//主页banner图片
            return ResultUtil.SUCCESS(advertList);
        }
        return ResultUtil.SUCCESS();
    }
}
